package com.mxpio.erp.common.equipment.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.erp.common.jpa.policy.ResCodeGeneratorPolicy;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.jpa.policy.impl.UUIDPolicy;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

/**
 * 稽核管理对象 EQUIPMENT_TPM_AUDIT
 *
 * @author Cheng
 * @date 2023-07-10
 */
@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_EQUIPMENT_AUDIT")
@Schema(description="稽核管理")
public class EquipmentAudit extends BaseEntity {

private static final long serialVersionUID=1L;


    @Id
    @Generator(policy = UUIDPolicy.class)
    @Column(name = "ID_")
    @Schema(description = "主键")
    private String id;

    @Column(name = "ORDER_CODE_")
    @Generator(policy = ResCodeGeneratorPolicy.class)
    @Schema(description = "工单编码")
    private String orderCode;

    @Column(name = "TARGET_TYPE_")
    @Schema(description = "目标类型")
    @Dict(dicCode = "ERP_EQUIPMENT_REPAIR_TARGET")
    private String targetType;

    @Column(name = "TARGET_ID_")
    @Schema(description = "目标ID")
    private String targetId;

    @Column(name = "TARGET_CODE_")
    @Schema(description = "设备/区域编码")
    private String targetCode;

    @Column(name = "TARGET_NAME_")
    @Schema(description = "设备/区域名称")
    private String targetName;

    @Column(name = "SITE_DESC_")
    @Schema(description = "位置描述")
    private String siteDesc;

    @Column(name = "AUDIT_TYPE_")
    @Schema(description = "稽核类型")
    @Dict(dicCode = "ERP_EQUIPMENT_AUDIT_TYPE")
    private String auditType;

    @Column(name = "AUDIT_START_TIME_")
    @Schema(description = "稽核开始时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date auditStartTime;

    @Column(name = "AUDIT_END_TIME_")
    @Schema(description = "稽核结束时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date auditEndTime;

    @Column(name = "AUDIT_STATE_")
    @Schema(description = "稽核状态")
    @Dict(dicCode = "ERP_EQUIPMENT_AUDIT_STATE")
    private String auditState;

    @Column(name = "MANAGER_ID_")
    @Schema(description = "责任主管")
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String managerId;

    @Column(name = "DEMAND_RECT_DATE_")
    @Schema(description = "要求整改时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date demandRectDate;

    @Column(name = "AUDIT_DESC_")
    @Schema(description = "稽核描述")
    private String auditDesc;

    @Column(name = "PIC_")
    @Schema(description = "稽核图片")
    private String pic;

    @Column(name = "ORG_ID_")
    @Schema(description = "作业组织")
    private String orgId;

    @Column(name = "TASK_ORG_TYPE_")
    @Schema(description = "作业组织类型")
    @Dict(dicCode = "ERP_EQUIPMENT_TASK_ORG_TYPE")
    private String taskOrgType;

    @Column(name = "AUDIT_TIME_")
    @Schema(description = "稽核时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date auditTime;

    @Column(name = "AUDITOR_ID_")
    @Schema(description = "稽核人")
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String auditorId;

    @Column(name = "ORDER_STATUS_")
    @Schema(description = "工单状态")
    @Dict(dicCode = "ERP_EQUIPMENT_AUDIT_STATUS")
    private String orderStatus;

    @Column(name = "RECT_DESC_")
    @Schema(description = "整改描述")
    private String rectDesc;

    @Column(name = "RECT_FINISH_TIME_")
    @Schema(description = "整改完成时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    private Date rectFinishTime;

    @Column(name = "RECT_ID_")
    @Schema(description = "整改人")
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String rectId;

    @Column(name = "RECT_PIC_")
    @Schema(description = "整改图片")
    private String rectPic;

    @Column(name = "ACCP_TIME_")
    @Schema(description = "验收时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    private Date accpTime;

    @Column(name = "ACCP_ID_")
    @Schema(description = "验收人")
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String accpId;

    @Column(name = "REJECT_STATUS_")
    @Schema(description = "用来记录该稽核是否有驳回记录，1 表示驳回 null或空表示未驳回")
    private String rejectStatus;

    @Column(name = "OVER_FLAG_")
    @Schema(description = "是否逾期")
    private Integer overFlag;

    @Column(name = "OVER_REASON_")
    @Schema(description = "逾期原因")
    private String overReason;

    @Column(name = "IS_DEL_")
    @Schema(description = "删除标记（0-正常；1-删除）")
    private Integer isDel;

    @Column(name = "SEND_TIME_")
    @Schema(description = "派工时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date sendTime;

    @Column(name = "BPM_STATUS_")
    @Schema(description = "流程状态")
    private String bpmStatus;

}
